package com.jz.community.moduleshopping.orderList.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleshopping.goodsDetail.ui.GoodsDetailView;
import com.jz.community.moduleshopping.orderList.bean.NewOrderListInfo;
import com.jz.community.moduleshopping.orderList.model.OrderModel;
import com.jz.community.moduleshopping.orderList.model.OrderModelImpl;
import com.jz.community.moduleshopping.orderList.view.OrderView;

/**
 * Created by Tony.Fan on 2018/4/27 16:11
 */
public class OrderPresenter extends BaseLifeCyclePresent<OrderView.View> implements OrderView.Presenter {

    private OrderModel orderModel;
    private OrderView.View orderView;

    public OrderPresenter(OrderView.View v) {
        orderView = v;
        orderModel = new OrderModelImpl(v.getContext());
    }

    @Override
    public void setPresenter(OrderView.View v) {
        super.setPresenter(v);
    }

    @Override
    public void getOrderInfo(String status, String page,boolean isNeedDialog) {
        orderModel.requestOrderInfo(status, page,isNeedDialog, new OnLoadListener<NewOrderListInfo>() {
            @Override
            public void onSuccess(NewOrderListInfo newOrderListInfo) {
                orderView.showOrderInfo(newOrderListInfo);
            }

            @Override
            public void onFail(String s,int code) {

            }
        });
    }
}
